import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const routes = [
    
    // 首页城市列表
    {
      name: 'login',
      path: '/login',
      //beforeEnter(to,from,next){
        //window.location="/login.html"
      //}
    },

    
    
   
  ]
  const router = new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
    
  })
  // 添加路由守卫
  /*
  next({
      path: '/login',
      query: {redirect: to.fullPath}  // 将跳转的路由path作为参数，登录成功后跳转到该路由
  
    })
    isLogin ? next() : next("/login");
  */
  router.beforeEach((to, from, next) => {
    const hasToken = localStorage.token ? true : false;
    if (to.path == "/userinfo" ) {
      //axios.get("http://localhost:8878/uouo").then(function(response) {
  
      //})
      if(hasToken){
        
      }
      next();
    } 
    next();
  })
  export default router